var ActionMoveBy = require('./../../../../../../FrameWork/Action/ActionMoveBy');
var UtilScqm = require('./../../../Utils/UtilScqm');
module.exports = cc.Class(
{
    extends: ActionMoveBy,
    properties:
    {
        randInitXVec2:
        {
            default: new cc.Vec2(-0.5, 0.5),
            displayName: '随机起始x轴'
        },

        randInitYVec2:
        {
            default: new cc.Vec2(0.55, 0.55),
            displayName: '随机起始y轴'
        }
    },


    getAction()
    {
        var x = UtilScqm.getRealVet2XRand(this.randInitXVec2);
        this.setPositionX(x);
        var y = UtilScqm.getRealVet2YRand(this.randInitYVec2);
        this.setPositionY(y);

        var actArray = [this._super(),
            cc.callFunc(function()
            {
                this.node.destroy();
            }.bind(this))
        ];
        var seq = cc.sequence(actArray);
        return seq;
    },

    onLoad()
    {
        if (this.isOnLoad)
        {
            this.runAction();
        }
    }
});